-
Notifications
You must be signed in to change notification settings - Fork 699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensure get returns a nil and key not found as per spec #844
Conversation
@@ -333,6 +333,18 @@ func keyValid(key string) bool { | |||
|
|||
// Get returns the latest value for the key. | |||
func (kv *kvs) Get(key string) (KeyValueEntry, error) { | |||
e, err := kv.get(key) | |||
if err == ErrKeyDeleted { | |||
return nil, ErrKeyNotFound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's critical that from the perspective of a user of Get() its always found/not found when delete or purge operation, we also discussed returning half baked Entries and agreed to return nil instead.
However we use the invalid behavior of the previous get operation in later functions in Create(), so I retained old behavior for internal use in get()
but made Get()
comply with spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since ErrKeyDeleted
is now internal only maybe I should unexport it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fc261d7
to
7cac399
Compare
updated for |
Signed-off-by: R.I.Pienaar <rip@devco.net>
7cac399
to
d7eb0d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: R.I.Pienaar rip@devco.net